package com.dankegongyu.lib.share.bean;

import android.app.Activity;
import android.graphics.Bitmap;

import com.dankegongyu.lib.share.DKShareCallback;
import com.dankegongyu.lib.share.DKShareUtil;
import com.dankegongyu.lib.share.DK_SHARE_MEDIA;

/**
 * 分享web
 *
 * @author wupuquan
 * @version 1.0
 * @since 2018/3/12 17:33
 */
public class DKShareWeb extends DKShareObject<DKShareWeb> {

    private String shareUrl;
    private String shareImageUrl;
    private Bitmap shareImage;
    private int shareImageIcon;
    private DKShareMiniProgram miniProgram;

    private DKShareWeb(Activity activity) {
        super(activity);
    }

    public static DKShareWeb with(Activity activity) {
        return new DKShareWeb(activity);
    }

    public DKShareWeb setShareUrl(String shareUrl) {
        this.shareUrl = shareUrl;
        return this;
    }

    public String getShareUrl() {
        return shareUrl;
    }

    public DKShareWeb setShareImageUrl(String shareImageUrl) {
        this.shareImageUrl = shareImageUrl;
        return this;
    }

    public String getShareImageUrl() {
        return shareImageUrl;
    }

    public DKShareWeb setShareImage(Bitmap shareImage) {
        this.shareImage = shareImage;
        return this;
    }

    public Bitmap getShareImage() {
        return shareImage;
    }

    public DKShareWeb setShareImageIcon(int shareImageIcon) {
        this.shareImageIcon = shareImageIcon;
        return this;
    }

    public int getShareImageIcon() {
        return shareImageIcon;
    }

    /**
     * 小程序
     *
     * @param miniProgram {@link DKShareMiniProgram}
     */
    public DKShareWeb setMiniProgram(DKShareMiniProgram miniProgram) {
        this.miniProgram = miniProgram;
        return this;
    }

    public DKShareMiniProgram getMiniProgram() {
        return miniProgram;
    }

    @Override
    public void show() {
        DKShareUtil.shareDefault(this, null);
    }

    @Override
    public void show(DKShareCallback shareCallback) {
        DKShareUtil.shareDefault(this, shareCallback);
    }

    @Override
    public void shareDirect(DK_SHARE_MEDIA dk_share_media) {
        shareDirect(dk_share_media, null);
    }

    @Override
    public void shareDirect(DK_SHARE_MEDIA dk_share_media, DKShareCallback shareCallback) {
        DKShareUtil.share(dk_share_media.getName(), this, shareCallback);
    }

    @Override
    public DKMediaType getShareMedia() {
        return DKMediaType.WEB;
    }

}
